Skip to content

add defined type postgresql::server::reassign_owned_by #894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2017

Conversation

georgehansper
Copy link
Contributor

This is a new defined type postgresql::server::reassign_owned_by which runs the SQL:

  • REASSIGN OWNED BY "old_role" TO "new_role"

on a given database.


if($db != undef and defined(Postgresql::Server::Database[$db])) {
Postgresql::Server::Database[$db]->Postgresql_psql["reassign_owned_by:${db}:${sql_command}"]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for future reference, due to parse ordering, if the Postgresql::Server::Database or role is not yet parsed at the time that this code runs, then it will not be defined() and this will not add the dependency even though the database/role will be declared later in the compile. To avoid this, we use collectors for conditional dependencies:

Postgresql::Server::Role <| title == $old_role |> -> Postgresql_psql["reassign_owned_by:${db}:${sql_command}"]
Postgresql::Server::Role <| title == $new_role |> -> Postgresql_psql["reassign_owned_by:${db}:${sql_command}"]
Postgresql::Server::Database <| title == $db |> -> Postgresql_psql["reassign_owned_by:${db}:${sql_command}"]

@hunner hunner merged commit b49143f into puppetlabs:master Jul 6, 2017
hunner added a commit that referenced this pull request Jul 6, 2017
add defined type postgresql::server::reassign_owned_by
cegeka-jenkins pushed a commit to cegeka/puppet-postgresql that referenced this pull request Feb 3, 2022
add defined type postgresql::server::reassign_owned_by
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants